{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/css/layui.css">
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>测评列表</h5>
        </div>
        <div class="ibox-content">
            <!--搜索框开始-->           
            <div class="row">
                <div class="col-sm-12">
                    <form name="admin_list_sea" class="form-search" method="post" action="{:url('index')}">
                       

                        <div class="col-xs-1">
                            <input type="text" id="realname" class="form-control" name="realname" value="{$realname}" placeholder="测评人查询" />
                        </div>

                        <div class="col-xs-2">
                            <input type="text" id="phone" class="form-control" name="phone" value="{$phone}" placeholder="手机号查询" />
                        </div>


                        <div class="col-xs-2">
                            <input type="text" id="add_time" class="form-control" name="add_time" value="{$add_time}" placeholder="测评时间查询" />
                        </div>


                                 <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </form>



                </div>
            </div>
            <!--搜索框结束-->
            <div class="hr-line-dashed"></div>
               <input type="hidden" value="{$page}" id="pp">
            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                                <th>ID</th>
                                <th>所属用户</th>
                                <th>手机号</th>
                                <th>测评</th>
                                <th>测评结果</th>
                                <th>测评时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <script id="list-template" type="text/html">
                            {{# for(var i=0;i<d.length;i++){  }}

                            <tr class="long-td">
                                <td>{{d[i].id}}</td>
                                <td>{{d[i].realname}}</td>
                                <td>{{d[i].phone}}</td>
                                <td>{{d[i].title}}</td>
                                <td>{{d[i].score_title}}</td>
                                <td>{{d[i].create_time}}</td>
                                <td>
                                    <a href="javascript:;" onclick="showOrderDetail({{d[i].id}})" class="btn btn-primary btn-outline btn-xs">
                                        <i class="fa fa-home"></i> 详情</a>&nbsp;&nbsp;
                                </td>
                            </tr>
                            {{# } }}
                        </script>
                        <tbody id="list-content"></tbody>
                    </table>
                    <div id="AjaxPage" style=" text-align: right;"></div>
                    <div id="allpage" style=" text-align: right;"></div>
                </div>
            </div>
            <!-- End Example Pagination -->
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>

<!-- 加载动画 -->
<div class="spiner-example">
    <div class="sk-spinner sk-spinner-three-bounce">
        <div class="sk-bounce1"></div>
        <div class="sk-bounce2"></div>
        <div class="sk-bounce3"></div>
    </div>
</div>

{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/js/layui.js"></script>
<script type="text/javascript">


    //提交
    $(function(){


        layui.use('laydate', function()
        {
            var laydate = layui.laydate;
            //常规用法
            laydate.render({
                elem: '#add_time',
                range: '~'
            });

        });

    });


    //laypage分页
    Ajaxpage();
    function Ajaxpage(curr){
        var realname=$('#realname').val();
        var add_time=$('#add_time').val();
        var phone=$('#phone').val();
		if(curr && curr >= 1){
            $('#pp').val(curr);
        }else{
            curr =  $('#pp').val();
        }
        $.getJSON('{:url("Order/index")}', {page: curr || 1,realname:realname,phone:phone,add_time:add_time}, function(data){
            console.log(data);
            $(".spiner-example").css('display','none'); //数据加载完关闭动画 
            if(data==''){
                $("#list-content").html('<td colspan="20" style="padding-top:10px;padding-bottom:10px;font-size:16px;text-align:center">暂无数据</td>');
            }else{
                var tpl = document.getElementById('list-template').innerHTML;
                laytpl(tpl).render(data, function(html){
                    document.getElementById('list-content').innerHTML = html;
                });
                laypage({
                    cont: $('#AjaxPage'),//容器。值支持id名、原生dom对象，jquery对象,
                    pages:'{$allpage}',//总页数
                    skip: true,//是否开启跳页
                    skin: '#1AB5B7',//分页组件颜色
                    curr: curr || 1,
                    groups: 3,//连续显示分页数
                    jump: function(obj, first){
                        if(!first){
                            Ajaxpage(obj.curr)
                        }
                        $('#allpage').html('第'+ obj.curr +'页，共'+ obj.pages +'页');
                    }
                });
            }
        });
    }

    //编辑轮播
    function showOrderDetail(id){
        console.log(id);
        location.href = "{:url('detail')}?id="+id+'&page='+$('#pp').val();
        //location.href = './goodsPhotoEdit/id/'+id+'.html';
    }


    function ddOrder(id) {
        lunhui.confirm(id,'{:url("addDOrder")}');
    }

    function exportExcel()
    {
        var sn=$('#sn').val();
        var nickname=$('#nickname').val();
        var order_status=$('#order_status').val();
        var order_type=$('#order_type').val();
        var pay_type=$('#pay_type').val();
        var add_time=$('#add_time').val();
        window.location.href = "{:url('exportOrder')}?sn="+sn+"&nickname="+nickname+"&order_status="+order_status+"&pay_type="+pay_type+"&add_time="+add_time+"&order_type="+order_type;
    }

</script>
</body>
</html>